package im.xz.cn.xiacore.chat;
import im.xz.cn.xiacore.methods.rank;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
public class chatMain implements Listener {
    @EventHandler
    public void awa(PlayerChatEvent event) {
        Player player = event.getPlayer();
        event.setCancelled(true);
        String message = event.getMessage();
        String name = player.getName();
        for (Object www : player.getServer().getOnlinePlayers().toArray()) {
            Player every = (Player) www;
            String fix = "[未获取到rank信息]" + name;
            try {
                int qaq = rank.getRank(player);
                if (qaq == 0) {
                    fix = ChatColor.GRAY + name + ChatColor.RESET;
                }else if (qaq == 1) {
                    fix = ChatColor.GREEN + "[VIP]" + name + ChatColor.RESET;
                }else if (qaq == 2) {
                    fix = ChatColor.GREEN + "[VIP" + ChatColor.LIGHT_PURPLE + "+" + ChatColor.GREEN + "]" + name + ChatColor.RESET;
                }else if (qaq == 3) {
                    fix = ChatColor.AQUA + "[MVP]" + name + ChatColor.RESET;
                }else if (qaq == 4) {
                    fix = ChatColor.AQUA + "[MVP" + ChatColor.LIGHT_PURPLE + "+" + ChatColor.AQUA + "]" + name + ChatColor.RESET;
                }else if (qaq == 621) {
                    fix = ChatColor.LIGHT_PURPLE + "[Gemini]" + name + ChatColor.GOLD;
                }
            }catch (NullPointerException ignore) {
            }
            every.sendMessage(fix + ChatColor.RESET + ": " + message);
        }
    }
}